<template>
  <div class="kh-container" id="app">
    <div class="kh-nav-top">
      <a href="javascript:;" class="kh-nav-logo"></a>
      <a href="javascript:;" class="kh-nav-close" :class="{'kh-nav-close-actv':!isShow}" @click="viewMenu">
        <span></span>
        <span></span>
        <span></span>
      </a>
    </div>

    <nav class="kh-nav" :class="{'kh-home-hidden': isShow}">
      <div class="kh-nav-menu-main">
        <ul>
          <li v-for="(item, index) in arrayUnshift" :key="index">
            <router-link :to="item.path" class="kh-nav-menu kh-nav-menu-actv"> {{item.name}}</router-link>
          </li>
        </ul>
      </div>
    </nav>

    <section>
      <div class="kh-home">
        <div class="kh-home-main">
          <div class="kh-home-menu" v-for="(item,index) in menu" :key="index">
            <a href="javascript:;" class="kh-home-menu-img">
              <img :src="item.imgUrl" alt="img">
            </a>
            <router-link :to="item.path" class="kh-home-menu-link">{{item.title}}</router-link>
            <p>{{ item.describe }}</p>
          </div>
        </div>
      </div>
    </section>
  </div>
</template>

<script>
    export default {
        name: "index",
        data: function(){
          return {
            isShow: true,
            menu: [
              {
                title: '案例',
                name: 'Case',
                describe: 'H5页面，网页 展示',
                imgUrl: require('@/assets/blog/home_1.png'),
                path: 'case',
              },
              {
                title: '文章',
                name: 'Article',
                describe: '关于web java ui、 html等文章',
                imgUrl: require('@/assets/blog/home_2.png'),
                path: 'article'
              },
              {
                title: '特效',
                name: 'Practice',
                describe: '酷炫canvas， H5动画',
                imgUrl: require('@/assets/blog/home_3.png'),
                path: 'practice'
              },
              {
                title: '关于',
                name: 'About',
                describe: '关于此网站',
                imgUrl: require('@/assets/blog/home_4.png'),
                path: 'about'
              }
            ],
            nav: ''
          }
        },
      computed: {
        arrayUnshift(){
          // console.log(this.menu)
          this.nav = [...this.menu];
          this.nav.unshift({
            name: 'Home',
            path: 'case',
          })
          return this.nav;
        }
      },
        methods: {
          viewMenu: function () {
            this.isShow = !this.isShow;
          }
        }
    }
</script>

<style lang="scss" scoped>
  .kh-container {
    width: 100%;
    height: 100%;
  }

  .kh-nav {
    z-index: 100;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #D8ECEB; // kh-nav-color
    transition: opcity .5s;
  }

  .kh-nav-top {
    z-index: 999;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding: 2% 8% 0;
    display: flex;
    box-sizing: border-box;
    justify-content: space-between;

    .kh-nav-logo {
      display: inline-block;
      width: 128px;
      height: 58px;
      background-image: url("../../../static/blog/logo.png");
      background-size: 100%;
      background-repeat: no-repeat;
      background-position: center;
  }

    .kh-nav-close {
      position: relative;
      width: 30px;
      height: 24px;
      margin-top: 16px;
      display: inline-block;

      span {
        position: absolute;
        left: 0;
        top: 0;
        height: 4px;
        width: 100%;
        display: block;
        border-radius: 2px;
        background-color: #000;
        transition: .2s;

        &:nth-child(2) {
          margin-top: 10px;
      }

        &:nth-child(3) {
          margin-top: 20px;
      }
    }
  }

    .kh-nav-close-actv{
      span {
        &:nth-child(1) {
          transform: rotate(45deg) translate(10px, 9px);
      }

        &:nth-child(2) {
          opacity: 0;
      }

        &:nth-child(3) {
          transform: rotate(-45deg) translate(5px, -4px);
      }
    }
  }
  }

  .kh-nav-menu-main {
    text-align: center;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);

    .kh-nav-menu {
      display: block;
      font-size: 24px;
      color: #000;
      opacity: .6;
      padding-bottom: 26px;
      margin-bottom: 40px;
      position: relative;

      &:hover {
        opacity: 1;

        &:after {
          transform: rotateY(360deg);
      }
    }

      &:after {
        content: '';
        position: absolute;
        bottom: 0;
        left: calc(50% - 10px);
        width: 20px;
        height: 20px;
        transform:rotateY(0);
        background-image: url("../../../static/blog/kh-nav-rotate.png");
        background-size: 100%;
        background-repeat: no-repeat;
        background-position: center;
        transition: transform 1s;
    }
  }


    .kh-nav-menu-actv {
      opacity: 1;

      &:after {
        transform: rotateY(360deg) translateZ(0);
    }
  }
  }

  // logo
  .kh-lg {
    position: relative;
    width: 128px;
    height: 58px;
    background: red;

    i {
      z-index: 999;
      position: absolute;
      background-position: center;
      background-repeat: no-repeat;
      background-size: auto;
  }

    /*.kh-lg1 {*/
      /*background-image: url("../../src/blog-img/logo/logo1.png");*/
  /*}*/

    /*.kh-lg2 {*/
      /*background-image: url("../../src/blog-img/logo/logo2.png");*/
  /*}*/

    /*.kh-lg3 {*/
      /*background-image: url("../../src/blog-img/logo/logo3.png");*/
  /*}*/

    /*.kh-lg4 {*/
      /*background-image: url("../../src/blog-img/logo/logo4.png");*/
  /*}*/

    /*.kh-lg5 {*/
      /*background-image: url("../../src/blog-img/logo/lg1.png");*/
  /*}*/

    /*.kh-lg6 {*/
      /*background-image: url("../../src/blog-img/logo/lg2.png");*/
  /*}*/

    /*.kh-lg7 {*/
      /*background-image: url("../../src/blog-img/logo/lg3.png");*/
  /*}*/

    /*.kh-lg8 {*/
      /*background-image: url("../../src/blog-img/logo/lg4.png");*/
  /*}*/

    /*.kh-lg9 {*/
      /*background-image: url("../../src/blog-img/logo/lg5.png");*/
  /*}*/
  }


  // home-menu -style
  .kh-home {
    z-index: 99;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 100%;
    background-image: url("../../../static/blog/home_bg.png");
    background-size: 100% 100%;
    background-repeat: no-repeat;
    background-position: center;
    transition: all .5s;
  }

  .kh-home-main {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    min-width: 1200px;
    width: 80%;
    margin: 0 auto;
    display: flex;
    justify-content: center;
    align-items: flex-start;
  }

  .kh-home-menu {
    font-size: 20px;
    color: #4ed3e7;
    width: 150px;
    text-align: center;
    margin-right: 100px;

    &:last-child {
      margin-right: 0;
  }

    .kh-home-menu-link {
      display: block;
      color: #4ed3e7;
      margin: 20px 0;
  }

    p {
      font-size: 16px;
  }

    .kh-home-menu-img {
      position: relative;
      display: inline-block;
      width: 150px;
      height: 150px;
      border-radius: 50%;
      background-image: url("../../../static/blog/home_img_bg.png");
      background-size: 100%;
      background-repeat: no-repeat;
      background-position: center;

      img {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 100px;
    }
  }
  }

  .kh-home-hidden {
    opacity: 0 !important;
    z-index: 0 !important;
  }

</style>
